﻿Public Class clsDateTimePicker

    Private dtRetString As DateTime


    Public Function return_value(ByVal dateString As String) As Date
        Try
            If Not dateString = "" Then
                Me.dtDate.Value = dateString
                Me.dtTime.Value = dateString
            End If
        Catch ex As Exception

        End Try
        If Not dateString = Nothing Then
            dtRetString = dateString
        End If



        Me.ShowDialog()
        Return dtRetString


    End Function

    Private Sub butCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butCancel.Click
        dtRetString = New DateTime
        Me.Close()
    End Sub

    Private Sub butOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles butOK.Click
        dtRetString = Me.dtDate.Value.Date + Me.dtTime.Value.TimeOfDay

        'dtRetString = Me.dtDate.Value.Date.Month.ToString & "/" & Me.dtDate.Value.Date.Day.ToString & "/" & Me.dtDate.Value.Date.Year.ToString)
        'dtRetString = dtRetString + " " + Me.dtTime.Value.TimeOfDay




        Me.Close()
    End Sub


    Public Sub New()

        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        '*// Form Caption
        Me.Text = "Select date - time"

        ' Add any initialization after the InitializeComponent() call.
        dtTime.Format = DateTimePickerFormat.Custom
        dtTime.CustomFormat = "HH:mm"


    End Sub

End Class